<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0,viewport-fit=cover" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>实验评审</title>
    <link rel="stylesheet" type="text/css" href="../css/vant.css">
    <link rel="stylesheet" type="text/css" href="../css/base.css" />
    <link rel="stylesheet" type="text/css" href="../css/local.css" />
    <script type="text/javascript" src="../script/jquery.js"></script>
    <script type="text/javascript" src="../script/layer/mobile/layer.js"></script>
    <script type="text/javascript" src="../script/vue.min.js"></script>
    <script type="text/javascript" src="../script/vant.min.js"></script>
    <script type="text/javascript" src="../script/fastclick.js"></script>
    <script type="text/javascript" src="../script/base.js"></script>
    <script type="text/javascript" src="../script/app-tree.js"></script>
    <style type="text/css">
        .part {
            padding: 15px 15px 0 15px;
        }

        .part .pf {
            border-radius: 6px;
            box-shadow: 0px 1px 5px rgb(200, 198, 198);
            background-color: #fff;
            overflow: hidden;
        }

        .textarea {
            display: block;
        }

        .label {
            padding: 10px 16px;
        }

        .ap-f {
            border-bottom: 1px solid #f7f7f7;
        }

        .f-r {
            /* padding: 17px 0; */
        }

        .mark {
            padding: 17px 15px;
        }

        .mark1 {
            padding: 17px 5px 17px 15px;
            position: relative;
        }

        .f-sub {
            color: #969799;
            font-size: 13px;
            margin-top: 4px;
        }

        .line {
            position: relative;
            width: 30px;
        }

        .line1 {
            width: 60px;
        }

        .line-sq {
            display: inline-block;
            width: 11px;
            height: 11px;
            border-radius: 6px;
            background: #d6d6d6;
            position: absolute;
            left: 0;
            top: 12px;
        }

        .line-li {
            display: inline-block;
            width: 1px;
            background: #d6d6d6;
            position: absolute;
            left: 5px;
            top: -17px;
            bottom: -17px;
        }

        .line-li1 {
            display: inline-block;
            background: #d6d6d6;
            position: absolute;
            top: 52px;
            left: 35px;
            width: 3px;
            bottom: 10px;
        }

        .pd {
            padding: 16px 0;
        }

        .ap-r {
            text-align: right;
            padding-right: 10px;
            /* margin: -8px 0; */
            padding-top: 10px;
        }

        .ap-d {
            text-align: right;
            padding-right: 10px;
            color: #ccccce;
            font-size: 13px;
            float: right;
            padding-top: 3px;
        }

        .img {
            width: 34px;
            height: 34px;
            line-height: 34px;
            text-align: center;
            font-size: 12px;
            color: #fff;
            background-color: #3396fb;
            border-radius: 6px;
            margin: 0 auto;
            position: relative;
            user-select: none;
        }

        .img1 {
            width: 44px;
            height: 44px;
            line-height: 44px;
            text-align: center;
            font-size: 13px;
            color: #fff;
            background-color: #3396fb;
            border-radius: 6px;
            position: relative;
            user-select: none;
        }

        .dis-ib {
            display: inline-block;
            vertical-align: middle;
            text-align: center;
            min-width: 40px;
        }

        .dis2-ib {
            display: inline-block;
            vertical-align: middle;
            padding-bottom: 3px;
            text-align: center;
        }

        .dis3-ib {
            display: inline-block;
            margin: 0 6px;
            color: #969799;
            vertical-align: top;
            padding-top: 7px;
            text-align: center;
        }

        .ap-n {
            padding-top: 2px;
            font-size: 13px;
            color: #969799;
            text-align: center;
        }

        .bottom {
            padding: 8px 15px;
        }

        .part-white {
            padding: 15px;
            background-color: #fff;
            position: relative;
        }

        .title {
            line-height: 40px;
            font-size: 18px;
        }

        .title-sub {
            color: #aaacac;
            font-size: 13px;
        }

        .title-read {
            color: #3396fb;
            font-size: 13px;

        }

        .title-unread {
            color: #788a8a;
            font-size: 13px;
        }

        .ap-res {
            color: #a3a3a3;
            font-size: 15px;
            padding-top: 6px;
        }

        .ap-res1 {
            color: #c31616;
            font-size: 15px;
            padding-top: 6px;
        }

        .ap-img {
            position: absolute;
            right: 20px;
            bottom: -38px;
            width: 88px;
            opacity: 0.4;
        }

        .form-row {
            padding: 4px 16px;
        }

        .form-label {
            color: #808991;
            font-size: 13px;
            user-select: none;
        }

        .form-content {
            padding-top: 5px;
        }

        .npd {
            padding-top: 0;
            overflow-x: auto;
        }

        .pl {
            color: #969799;
            font-size: 16px;
            margin: 6px 2px 18px 0;
            min-height: 25px;
            border-bottom: 1px solid #ebedf0;
        }

        .sf {
            width: 16px;
            background: #fff;
            padding: 2px;
            border-radius: 8px;
            position: absolute;
            right: -5px;
            bottom: -2px;
        }

        .select {
            color: #3396fb;
            float: right;
            font-size: 13px;
            padding-top: 3px;
            vertical-align: middle;
        }

        .select a {
            vertical-align: middle;
        }

        .select img {
            width: 16px;
            vertical-align: middle;
        }

        .hq {
            padding: 10px 10px 0 0;
        }

        .wh {

            white-space: nowrap;
            overflow-x: auto;
            padding-right: 10px;
        }

        .plpd {
            padding-bottom: 5px;
        }

        .pictitle {
            line-height: 24px;
            color: #646566;
            user-select: none;
        }

        .piccontent {
            padding-top: 10px;
            overflow: hidden;
        }

        .van-uploader__preview {
            margin-right: 15px;
        }

        .no {
            text-align: center;
            color: #808991;
            font-size: 14px;
        }

        .li1 {
            top: 15px;
        }

        .li2 {
            bottom: 24px;
        }

        .da-c {
            color: #c31616;
        }

        .danger .van-field__control {
            color: #c31616;
        }

        .danger .van-field__label {
            color: #808991;
        }

        .ac-1 {
            color: #03b553;
        }

        .ac-2 {
            color: #c31616;
        }

        .checkbox {
            padding: 25px 5px 10px 10px;
        }

        .jl-remark {
            padding: 5px 0;
            color: #3396fb;
        }

        .memo-l {
            border-bottom: 1px solid rgb(235, 237, 240);
            padding: 4px 0;
        }

        .memo-l:last-child {
            border-bottom: 0;
        }

        .delete-button {
            height: 100%;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <div class="box">
            <van-nav-bar-main title="实验评审" left-arrow @click-left="onClickLeft"></van-nav-bar-main>
            <div class="content" style="padding-bottom: 20px;">
                <div v-if="(status == 0 || approvalAgain) && isExamine == 0">
                    <div class="part">
                        <div class="pf">
                            <van-field class="textarea danger" rows="1" autosize v-model="form.opinion" label="拒绝原因"
                                type="textarea" readonly v-if="form.opinion">
                            </van-field>
                            <van-field v-model="form.code" label="单号" placeholder="请输入单号" readonly></van-field>
                            <!-- <van-field required v-model="form.project" label="项目" placeholder="请输入项目"></van-field> -->
                            <!-- <van-field required v-model="form.pname" label="项目产品名称" placeholder="请选择产品名称" readonly
                                right-icon="arrow" @click="openBaseScreen('产品')"></van-field>
                            <van-field required v-model="form.pcode" label="产品编号" placeholder="请选择产品编号" readonly
                                right-icon="arrow" @click="openBaseScreen('产品')"></van-field> -->
                            <van-field required v-model="form.ExptItemName" label="实验项目" placeholder="请选择实验项目" readonly
                                right-icon="arrow" @click="openBaseScreen('实验项目')"></van-field>
                            <van-field required v-model="form.procedurename" label="发生工序" placeholder="请选择发生工序" readonly
                                right-icon="arrow" @click="showProcedureAction = true;"></van-field>
                            <van-cell>
                                <div class="pictitle">不良类型</div>
                                <div style="padding-top:5px;">
                                    <van-radio-group v-model="form.badtype" icon-size="18px" direction="horizontal">
                                        <van-radio name="外观">外观</van-radio>
                                        <van-radio name="尺寸">尺寸</van-radio>
                                        <van-radio name="性能">性能</van-radio>
                                        <van-radio name="其他">其他</van-radio>
                                    </van-radio-group>
                                </div>
                            </van-cell>
                            <van-field required class="textarea" v-model="form.reason" rows="3" autosize label="不良原因"
                                type="textarea" placeholder="请输入不良原因">
                            </van-field>
                            <van-cell>
                                <div class="pictitle">是否指定责任返工部门</div>
                                <div style="padding-top:5px;">
                                    <van-radio-group v-model="form.isReworkDepart" icon-size="18px"
                                        direction="horizontal">
                                        <van-radio :name="true">是</van-radio>
                                        <van-radio :name="false">否</van-radio>
                                    </van-radio-group>
                                </div>
                            </van-cell>
                            <van-cell>
                                <div class="pictitle">图片</div>
                                <div class="piccontent">
                                    <div class="van-uploader">
                                        <div class="van-uploader__wrapper">
                                            <div class="van-uploader__preview"
                                                v-for="(imgItem,imgItemIndex) in form.imgArray">
                                                <div class="van-image van-uploader__preview-image"
                                                    style="overflow: hidden; border-radius: 4px;"
                                                    @click="previewImage(imgItemIndex,1)">

                                                    <img :src="serverIP + imgItem" class="van-image__img"
                                                        style="object-fit: cover;" />
                                                </div>
                                                <div class="van-uploader__preview-delete"
                                                    @click="deleteImgItem(imgItemIndex)">
                                                    <i
                                                        class="van-icon van-icon-cross van-uploader__preview-delete-icon"></i>
                                                </div>

                                            </div>
                                            <div class="van-uploader__upload" v-if="form.imgArray.length < 15"
                                                @click="addImage(form.imgArray.length)">
                                                <i class="van-icon van-icon-plus van-uploader__upload-icon"></i>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </van-cell>
                            <!-- <van-field class="textarea" v-model="form.remark" rows="3" autosize label="备注"
                                 type="textarea" placeholder="请输入备注">
                             </van-field> -->
                        </div>
                    </div>

                    <!-- 实验明细 -->
                    <div class="part">
                        <div class="pf">
                            <van-swipe-cell v-for="(row,index) in dataList">
                                <van-cell>
                                    <van-row>
                                        <van-col span="24">
                                            <van-field required v-model="row.ProductName" label="产品名称"
                                                label-width="60px" placeholder="请选择产品名称" readonly
                                                @click="selectProduct(index)"></van-field>
                                        </van-col>
                                        <van-col span="12">
                                            <van-field v-model="row.Batch" label="批次" label-width="60px"
                                                placeholder="请输入批次">
                                            </van-field>
                                        </van-col>
                                        <van-col span="12">
                                            <van-field required v-model="row.Result" label="实验结果" label-width="60px"
                                                placeholder="请选择实验结果" readonly @click="selectExResult(index)">
                                            </van-field>
                                        </van-col>
                                    </van-row>
                                </van-cell>

                                <template #right>
                                    <van-button square type="danger" text="删除" @click="deleteRow(index)"
                                        class="delete-button" />
                                </template>
                            </van-swipe-cell>
                            <van-cell>
                                <van-row>
                                    <van-col span="24" style="text-align: center;">
                                        <van-button icon="plus" color="" type="primary" size="small"
                                            @click="addDtlItem">请添加实验记录</van-button>
                                    </van-col>
                                </van-row>
                            </van-cell>
                        </div>
                    </div>

                    <div class="part">
                        <div class="pf">
                            <van-field required v-model="form.personname" label="申请人" placeholder="请选择申请人" readonly>
                            </van-field>
                            <van-field v-model="form.persondepartname" label="申请部门" placeholder="请选择部门" readonly>
                            </van-field>
                            <!-- <van-field v-model="timeout" type="number" label="超时时间(分钟)" placeholder="请输入审批超时时间">
                             </van-field> -->
                        </div>
                    </div>

                </div>


                <div v-if="((status == 1 || status == 2) && !approvalAgain) || isExamine != 0">
                    <div class="part-white">
                        <div class="title">{{creater}}提交的实验评审</div>
                        <!-- <div class="title-sub">宁波劳伦斯表面技术有限公司</div> -->
                        <div class="ap-res">{{finalResult==0?'正在审批中':(finalResult==1?'审批已通过':'审批已拒绝')}}</div>
                        <div class="ap-res1" v-if="form.reworkDepart">返工部门：{{form.reworkDepart}}</div>
                        <!-- <img class="ap-img" v-if="finalResult!=0" :src="'../image/ap-'+ finalResult +'.png'" /> -->
                        <div style="padding-bottom: 10px;"></div>
                        <div class="title-read" v-if="readArray.length">
                            <span v-for="(row,index) in readArray">{{row.LogCount}}<span
                                    v-if="index != readArray.length - 1">,</span></span>已读
                        </div>
                        <div class="title-unread" v-if="unReadArray.length">
                            <span v-for="(row,index) in unReadArray">{{row.Approver}}<span
                                    v-if="index != unReadArray.length - 1">,</span></span>未读
                        </div>
                        <img class="ap-img" v-if="form.isFinish" src="../image/ap-1.png" />



                    </div>
                    <div class="part">
                        <div class="pf">
                            <div class="form-row">
                                <div class="form-label">单号</div>
                                <div class="form-content">{{form.code}}</div>
                            </div>
                            <!-- <div class="form-row">
                                 <div class="form-label">项目</div>
                                 <div class="form-content">{{form.project}}</div>
                             </div> -->
                            <!-- <div class="form-row">
                                <div class="form-label">项目产品名称</div>
                                <div class="form-content">{{form.pname}}</div>
                            </div> -->
                            <div class="form-row">
                                <div class="form-label">实验项目</div>
                                <div class="form-content">{{form.ExptItemName}}</div>
                            </div>
                            <!-- <div class="form-row">
                                <div class="form-label">产品编号</div>
                                <div class="form-content">{{form.pcode}}</div>
                            </div> -->
                            <div class="form-row" v-if="form.procedurename">
                                <div class="form-label">发生工序</div>
                                <div class="form-content">{{form.procedurename}}</div>
                            </div>
                            <div class="form-row" v-if="form.badtype">
                                <div class="form-label">不良类型</div>
                                <div class="form-content">{{form.badtype}}</div>
                            </div>
                            <div class="form-row">
                                <div class="form-label">不良原因</div>
                                <div class="form-content">{{form.reason}}</div>
                            </div>
                            <div class="form-row" v-if="form.badtype">
                                <div class="form-label">是否指定责任返工部门</div>
                                <div class="form-content">{{form.isReworkDepart?'是':'否'}}</div>
                            </div>
                            <van-cell>
                                <div class="form-label">图片</div>
                                <div class="piccontent">
                                    <div class="van-uploader">
                                        <div class="van-uploader__wrapper">
                                            <div class="van-uploader__preview"
                                                v-for="(imgItem,imgItemIndex) in form.imgArray">
                                                <div class="van-image van-uploader__preview-image"
                                                    style="overflow: hidden; border-radius: 4px;"
                                                    @click="previewImage(imgItemIndex,1)">

                                                    <img :src="serverIP + imgItem" class="van-image__img"
                                                        style="object-fit: cover;" />
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </van-cell>
                            <!-- <div class="form-row" v-if="form.remark">
                                 <div class="form-label">备注</div>
                                 <div class="form-content">{{form.remark}}</div>
                             </div> -->
                            <div class="form-row">
                                <div class="form-label">申请人</div>
                                <div class="form-content"><span
                                        v-if="form.persondepartname">{{form.persondepartname}}-</span><span>{{form.personname}}</span>
                                </div>
                            </div>


                            <div class="form-row" v-if="status == 0 && form.opinion">
                                <div class="form-label">审批意见</div>
                                <div class="form-content da-c">{{form.opinion}}</div>
                            </div>
                        </div>
                    </div>

                    <!-- 实验明细 -->
                    <div class="part">
                        <div class="pf">
                            <van-cell v-for="(row,index) in dataList">
                                <van-row>
                                    <van-col span="24">
                                        <van-field required v-model="row.ProductName" label="产品名称" label-width="60px"
                                            readonly></van-field>
                                    </van-col>
                                    <van-col span="12">
                                        <van-field v-model="row.Batch" label="批次" label-width="60px" readonly>
                                        </van-field>
                                    </van-col>
                                    <van-col span="12">
                                        <van-field required v-model="row.Result" label="实验结果" label-width="60px"
                                            readonly></van-field>
                                    </van-col>
                                </van-row>
                            </van-cell>
                        </div>
                    </div>




                </div>

                <div class="part" v-if="status == 0 && isExamine == 0">
                    <div class="pf">
                        <div class="label flex-box">
                            <span class="flex-main">{{selectApprovalData?selectApprovalData.name:''}}流程</span>
                            <span class="select" @click="selectApproval" v-if="isExamine == 1"><a>重置</a><img
                                    src="../image/gl.png" /></span>
                        </div>
                        <div class="pd">
                            <!-- <div v-if="!selectApprovalData" class="no">暂未选择审批流</div> -->
                            <div class="ap-f" v-for="(row,index) in approvalProcessList">
                                <div class="flex-box f-r">
                                    <div class="checkbox">
                                        <van-checkbox v-model="row.checked" checked-color="#30c11b"></van-checkbox>
                                    </div>
                                    <div class="mark">
                                        <div class="flex-box">
                                            <div class="line">
                                                <div class="line-sq"></div>
                                                <div class="line-li li1" v-if="index == 0"></div>
                                                <div class="line-li li2"
                                                    v-else-if="index == approvalProcessList.length - 1"></div>
                                                <div class="line-li" v-else></div>
                                            </div>
                                            <div>
                                                <div>
                                                    <div>{{row.nodeName}}</div>
                                                </div>
                                                <div class="f-sub">
                                                    <span v-if="row.type == 2">抄送通知</span>
                                                    <span v-if="row.type == 1 && row.node.length == 1">一人审批</span>
                                                    <span
                                                        v-if="row.type == 1 && row.node.length > 1 && row.approvalType == 1">{{getRealNum(row)}}人会签</span>
                                                    <span
                                                        v-if="row.type == 1 && row.node.length > 1 && row.approvalType == 0">{{getRealNum(row)}}人或签</span>
                                                </div>
                                            </div>
                                        </div>

                                    </div>
                                    <div class="flex-main ap-r" style="overflow:auto;white-space: nowrap;">
                                        <div class="dis2-ib" v-for="(item,itemIndex) in row.node">
                                            <div class="dis-ib">
                                                <div class="img" @click="toggleUserCheck(row,item)">
                                                    <span>{{cutStr(item.name)}}</span>
                                                    <img class="sf" src="../image/success.png" v-if="!item.unJoin" />
                                                </div>
                                                <div class="ap-n">{{item.name}}</div>
                                            </div>
                                            <div class="dis3-ib"
                                                v-if="itemIndex != row.node.length - 1 && row.type == 1 && row.approvalType == 1">
                                                +</div>
                                            <div class="dis3-ib"
                                                v-if="itemIndex != row.node.length - 1 && row.type == 2">+</div>
                                            <div class="dis3-ib"
                                                v-if="itemIndex != row.node.length - 1 && row.type == 1 && row.approvalType == 0">
                                                /</div>
                                        </div>

                                    </div>
                                </div>
                            </div>

                        </div>

                    </div>
                </div>



                <div v-if="(status == 1 || status == 2) && !approvalAgain">
                    <div class="part" v-for="approvalRow in approvalList">
                        <div class="pf">
                            <div class="label">流程</div>
                            <div class="pd">
                                <div>
                                    <div class="flex-box f-r">
                                        <div class="mark1 npd">
                                            <div class="line1">
                                                <div>
                                                    <div class="dis-ib">
                                                        <div class="img1"><span>{{creater}}</span><img class="sf"
                                                                src="../image/success.png" /></div>
                                                    </div>
                                                </div>
                                                <div class="line-li1"></div>
                                            </div>

                                        </div>
                                        <div class="flex-main npd">
                                            <div>
                                                <div>
                                                    <span>发起审批</span>
                                                    <span
                                                        class="ap-d">{{createTime.split('.')[0].replace(/T/g,'')}}</span>
                                                </div>
                                                <div class="f-sub">{{creater}}</div>
                                            </div>
                                            <div class="pl"></div>
                                        </div>
                                    </div>
                                </div>
                                <div v-for="(row,index) in approvalRow.approvalNodeList">
                                    <div class="flex-box f-r">
                                        <div class="mark1 npd">
                                            <div class="line1">
                                                <div>
                                                    <div class="dis-ib">
                                                        <div class="img1">
                                                            <span
                                                                v-if="row.node.length == 1 && row.node[0].CurrentApprovalIDs.length == 1 && row.type == 0">{{row.node[0].CurrentApprovalIDs[0]}}</span>
                                                            <van-icon v-else-if="row.type == 1" name="volume-o"
                                                                size="28px" style="padding-top: 7px;">
                                                            </van-icon>
                                                            <van-icon v-else name="friends-o" size="28px"
                                                                style="padding-top: 7px;"></van-icon>
                                                            <img class="sf"
                                                                v-if="approvalRow.level == row.index - 2 && row.type == 1 && row.node[0].Approve != 0"
                                                                src="../image/success.png" />
                                                            <img class="sf" v-if="approvalRow.level >= row.index - 1"
                                                                :src="getApprovalTagImg(row)" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="line-li1"
                                                    v-if="index != approvalRow.approvalNodeList.length - 1"></div>
                                            </div>

                                        </div>
                                        <div class="flex-main npd">
                                            <div>
                                                <div>
                                                    <div>
                                                        <span style="vertical-align: middle;"
                                                            v-if="row.type == 1">抄送人</span>
                                                        <span style="vertical-align: middle;"
                                                            v-else>{{row.department?row.department:'审批人'}}</span>
                                                        <span>
                                                            <van-icon name="more" color="#afd6ff"
                                                                style="vertical-align: middle;padding-left: 5px;"
                                                                @click="showMore(row)"></van-icon>
                                                        </span>
                                                        <span class="ap-d"
                                                            v-if="approvalRow.level == row.index - 2 && row.type == 1 && row.node[0].Approve != 0">{{row.node[0].ApproveTime}}</span>
                                                        <span class="ap-d"
                                                            v-if="approvalRow.level >= row.index - 1">{{row.node[0].ApproveTime}}</span>
                                                    </div>

                                                    <div class="f-sub" v-if="row.showMore">
                                                        <span
                                                            v-if="row.node.length == 1 && row.node[0].CurrentApprovalIDs.length == 1">{{row.node[0].CurrentApprovalIDs[0]}}</span>
                                                        <span
                                                            v-if="row.node.length == 1 && row.node[0].CurrentApprovalIDs.length > 1 && row.type == 0">{{row.node[0].CurrentApprovalIDs.length}}人或签</span>
                                                        <span
                                                            v-if="row.node.length > 1 && row.type == 0">{{row.node.length}}人会签</span>
                                                        <span
                                                            v-if="row.node.length > 1 && !checkIsSingle(row) && row.type == 0">多人审核</span>
                                                        <span
                                                            v-if="approvalRow.level == row.index - 2 && row.type == 1 && row.node[0].Approve != 0">（已抄送）</span>
                                                        <span
                                                            v-if="approvalRow.level >= row.index - 1">（{{getApprovalText(row)}}）</span>
                                                    </div>
                                                </div>
                                                <div class="hq" v-if="row.showMore">
                                                    <!-- 或签 -->
                                                    <div class="wh"
                                                        v-if="row.node.length == 1 && row.node[0].CurrentApprovalIDs.length > 1">
                                                        <div class="dis2-ib"
                                                            v-for="(item,itemIndex) in row.node[0].CurrentApprovalIDs">
                                                            <div class="dis-ib">
                                                                <div class="img">
                                                                    <span>{{cutStr(item)}}</span>
                                                                    <img class="sf"
                                                                        v-if="item == row.node[0].Approver && approvalRow.level >= row.index - 1 && row.node[0].Approve != 0"
                                                                        :src="row.node[0].Approve == 1?'../image/success.png':'../image/fail.png'" />
                                                                </div>
                                                                <div class="ap-n">{{item}}</div>
                                                            </div>
                                                            <div class="dis3-ib"
                                                                v-if="itemIndex != row.node[0].CurrentApprovalIDs.length - 1 && row.type == 0">
                                                                /</div>
                                                            <div class="dis3-ib" v-if="row.type == 1"> </div>
                                                        </div>

                                                    </div>
                                                    <!-- 会签 -->
                                                    <div class="wh" v-if="row.node.length > 1 && checkIsSingle(row)">
                                                        <div class="dis2-ib" v-for="(item,itemIndex) in row.node">
                                                            <div class="dis-ib">
                                                                <div class="img">
                                                                    <span>{{cutStr(item.CurrentApprovalIDs[0])}}</span>
                                                                    <img class="sf"
                                                                        v-if="item.Approver && item.Approver == item.CurrentApprovalIDs[0] && approvalRow.level >= row.index - 1 && item.Approve != 0"
                                                                        :src="item.Approve == 1?'../image/success.png':'../image/fail.png'" />
                                                                </div>
                                                                <div class="ap-n">{{item.CurrentApprovalIDs[0]}}</div>
                                                            </div>
                                                            <div class="dis3-ib"
                                                                v-if="itemIndex != row.node.length - 1 && row.type == 0">
                                                                +</div>
                                                            <div class="dis3-ib" v-if="row.type == 1"> </div>
                                                        </div>

                                                    </div>
                                                    <!-- 多人审核 -->
                                                    <div class="wh" v-if="row.node.length > 1 && !checkIsSingle(row)">
                                                        <div class="dis2-ib" v-for="(item,itemIndex) in row.node">
                                                            <div class="dis2-ib"
                                                                v-for="(detail,detailIndex) in item.CurrentApprovalIDs">
                                                                <div class="dis-ib">
                                                                    <div class="img">
                                                                        <span>{{cutStr(detail)}}</span>
                                                                    </div>
                                                                    <div class="ap-n">{{detail}}
                                                                    </div>
                                                                </div>
                                                                <div class="dis3-ib"
                                                                    v-if="itemIndex != row.node.length - 1">/</div>
                                                            </div>
                                                            <div class="dis3-ib"
                                                                v-if="itemIndex != row.node.length - 1"> </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="pl">
                                                    <div class="plpd" v-for="item in row.node">
                                                        <div>
                                                            <span v-if="item.ApprovalContent"
                                                                :class="'ac-' + item.Approve">{{item.Approver}}:</span>
                                                            <span v-if="item.ApprovalContent"
                                                                :class="'ac-' + item.Approve">"{{item.ApprovalContent}}"</span>
                                                        </div>

                                                        <div class="piccontent" v-if="item.Imgs">
                                                            <div class="van-uploader">
                                                                <div class="van-uploader__wrapper">
                                                                    <div class="van-uploader__preview"
                                                                        v-for="(imgItem,imgItemIndex) in (item.Imgs?item.Imgs.split(','):[])">
                                                                        <div class="van-image van-uploader__preview-image"
                                                                            style="overflow: hidden; border-radius: 4px;width:60px;height:60px;"
                                                                            @click="previewItemImage(item.Imgs,imgItemIndex,3)">

                                                                            <img :src="serverIP + imgItem"
                                                                                class="van-image__img"
                                                                                style="object-fit: cover;" />
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>

                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>




                                    <div class="flex-box f-r" v-if="index == approvalRow.approvalNodeList.length - 1">
                                        <div class="mark1 npd">
                                            <div class="line1">
                                                <div>
                                                    <div class="dis-ib">
                                                        <div class="img1">
                                                            <span>备注</span>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="line-li1"
                                                    v-if="index != approvalRow.approvalNodeList.length - 1"></div>
                                            </div>

                                        </div>
                                        <div class="flex-main npd">
                                            <div>
                                                <div>
                                                    <div>
                                                        <span style="vertical-align: middle;">备注</span>
                                                    </div>
                                                </div>
                                                <div class="pl">
                                                    <div class="jl-remark" v-if="editRemark && !form.memo"
                                                        @click="addRemark">添加备注</div>
                                                    <div class="jl-remark" v-if="form.memo">
                                                        <div class="piccontent">
                                                            <div class="van-uploader">
                                                                <div class="van-uploader__wrapper">
                                                                    <div class="van-uploader__preview"
                                                                        v-for="(imgItem,imgItemIndex) in form.memoImg">
                                                                        <div class="van-image van-uploader__preview-image"
                                                                            style="overflow: hidden; border-radius: 4px;width:60px;height:60px;"
                                                                            @click="previewImage(imgItemIndex,2)">

                                                                            <img :src="serverIP + imgItem"
                                                                                class="van-image__img"
                                                                                style="object-fit: cover;" />
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="memo-l" v-for="item in splitMemo()" v-if="item"
                                                            @click="addRemark">
                                                            <div><span>{{item.split('#')[0]}}</span></div>

                                                            <div style="color: #ccccce;font-size: 13px;">
                                                                <span>{{item.split('#')[1]}}</span>
                                                            </div>

                                                        </div>
                                                        <!-- <span style="vertical-align: middle;">{{form.memo}}</span> -->
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>


                                </div>
                            </div>

                        </div>
                    </div>
                </div>



            </div>
            <!-- 提交单据 -->
            <div class="bottom" v-if="status == 0 && isExamine == 0 && !form.id">
                <div class="flex-main">
                    <van-row gutter="30">
                        <van-col :span="24">
                            <van-button block :square="false" :disabled="ifConfirm" :loading="ifConfirm"
                                @click="savePage(false)">确认提交评审</van-button>
                        </van-col>
                    </van-row>
                </div>
            </div>
            <!-- 审批处理 -->
            <div class="bottom" v-if="status == 0  && form.id && !isSubmit">
                <!-- <div class="bottom" v-if="status == 0 && isExamine != 0 && form.id && !isSubmit"> -->
                <div class="flex-main">
                    <van-row gutter="30">
                        <van-col :span="12">
                            <van-button block :square="false" :disabled="ifConfirm" :loading="ifConfirm"
                                @click="dealApproval(2)">拒绝</van-button>
                        </van-col>
                        <van-col :span="12">
                            <van-button type="info" block :square="false" :disabled="ifConfirm" :loading="ifConfirm"
                                @click="dealApproval(1)">
                                输入审核意见或确认同意</van-button>
                        </van-col>
                    </van-row>
                </div>
            </div>
            <!-- 本次用不到 -->
            <div class="bottom" v-if="showButton == 1 && status != -1">
                <div class="flex-main">
                    <van-row gutter="30">
                        <!-- <van-col :span="12">
                             <van-button block :square="false" :disabled="ifConfirm" :loading="ifConfirm"
                                 @click="dealApproval(2)">拒绝</van-button>
                         </van-col> -->
                        <van-col :span="24">
                            <van-button type="info" block :square="false" :disabled="ifConfirm" :loading="ifConfirm"
                                @click="dealApproval(1)">
                                输入审核意见或确认同意</van-button>
                        </van-col>
                    </van-row>
                </div>
            </div>
            <!-- 本次用不到 -->
            <div class="bottom"
                v-if="status == 2 && finalResult == 1 && !form.isFinish && (userData.UserID == 19 || userData.UserID == 35)">
                <div class="flex-main">
                    <van-row gutter="30">
                        <van-col :span="24">
                            <van-button type="info" block :square="false" :disabled="ifConfirm" :loading="ifConfirm"
                                @click="closeRow">
                                确认完成单据</van-button>
                        </van-col>
                    </van-row>
                </div>
            </div>
            <!-- 重新提交审批 -->
            <div class="bottom"
                v-if="((status == 2 && creater == userData.UserName && finalResult == 2) || approvalAgain) && isExamine == 0">
                <div class="flex-main">
                    <van-row gutter="30">
                        <van-col :span="24">
                            <van-button type="info" block :square="false" :disabled="ifConfirm" :loading="ifConfirm"
                                @click="initiateApprovalAgain">再次提交评审</van-button>
                        </van-col>
                    </van-row>
                </div>
            </div>
        </div>

        <!-- <van-action-sheet v-model="showAction" :actions="approvalActions" cancel-text="取消" description="请选择审批流"
             close-on-click-action @select="confirmAction"></van-action-sheet> -->

        <!-- 工序选择 -->
        <van-action-sheet v-model="showProcedureAction" :actions="procedureActions" cancel-text="取消" description="请选择工序"
            close-on-click-action @select="confirmProcedureAction">
        </van-action-sheet>

        <!-- 实验结果选择 -->
        <van-action-sheet v-model="showResultAction" :actions="resultActions" cancel-text="取消" description="请选择结果"
            close-on-click-action @select="confirmResultAction">
        </van-action-sheet>
    </div>
</body>
<script type="text/javascript">
    var vm;
    apiready = function () {
        var UIAlbumBrowser = api.require('UIAlbumBrowser');
        var photoBrowser = api.require('photoBrowser');
        var isOpenImg = false;
        var approvalConfigdata = '';
        var allCurrentApprovalIDs = [];

        api.addEventListener({
            name: 'keyback'
        }, function (ret, err) {
            if (!isOpenImg) {
                vm.onClickLeft();
            } else {
                photoBrowser.close();
            }

        });

        api.addEventListener({
            name: 'submitApproval'
        }, function (ret, err) {
            var index = ret.value.index;
            var content = ret.value.content;
            var imgArray = ret.value.imgArray;
            var reworkDepart = ret.value.reworkDepart;
            if (vm.status == 0 || vm.status == 2) {
                vm.startApproval(index, content);
            } else {
                vm.submitApproval(index, content, imgArray, reworkDepart);


            }

        });

        api.addEventListener({
            name: 'submitRemark'
        }, function (ret, err) {
            var content = ret.value.content;
            var imgArray = ret.value.imgArray;
            var userids = [];
            for (var i in allCurrentApprovalIDs) {
                if (userids.indexOf(allCurrentApprovalIDs[i]) == -1) {
                    userids.push(allCurrentApprovalIDs[i])
                }
            }
            var obj = {
                Ck_ExperimentReviewID: vm.form.id,
                FRemarks: content,
                MemoImg: imgArray.join(),
                MsgUserIDs: userids.join()
            }
            //更新实验评审单审批流备注
            APP.ajax('updateExptRemarks', obj, function (res) {
                layer.open({
                    content: '备注添加成功',
                    skin: 'msg',
                    time: 2
                });
                APP.ajax('getExperimentInfo', { Ck_ExperimentReviewID: vm.form.id }, function (res) {
                    if (res.ds.length) {
                        vm.form.memo = res.ds[0].Memo;
                        vm.form.memoImg = res.ds[0].MemoImg ? res.ds[0].MemoImg.split(',') : [];
                    }
                })
            })
        });

        api.addEventListener({
            name: 'selectRow'
        }, function (ret, err) {
            var type = ret.value.type;
            var row = ret.value.row;
            if (type == '产品') {
                vm.dataList[vm.curRowIdx].ProductID = row[0].ProductID;
                vm.dataList[vm.curRowIdx].ProductName = row[0].ProductName;
            }
            if (type == '人员') {
                vm.form.personname = row[0].UserName;
                vm.form.personid = row[0].UserID;
                vm.form.persondepartname = row[0].ClassName || '';
                vm.form.persondepartid = row[0].ClassID || 0;
            }
            if (type == '实验项目') {
                vm.form.ExptItemID = row[0].ExptItemID;
                vm.form.ExptItemName = row[0].ExptItemName;
            }
        })


        vm = new Vue({
            el: '#app',
            data: {
                showLoading: false,
                ifConfirm: false,
                isExamine: api.pageParam.isExamine || 0,
                serverIP: 'http://' + APP.serverIP(),
                userData: APP.getUserInfo(),
                showButton: 0,
                isSubmit: false,
                personList: [],
                approvalAgain: false,
                showProcedureAction: false,
                showResultAction: false,
                procedureActions: [{
                    name: '品质'
                }, {
                    name: '包装'
                }, {
                    name: '注塑'
                }, {
                    name: '电镀'
                }, {
                    name: '喷漆'
                }, {
                    name: '装配'
                }, {
                    name: 'FQC'
                }, {
                    name: '蚀刻'
                }, {
                    name: '供应商'
                }],
                resultActions: [{
                    name: 'NG',
                }, {
                    name: 'OK',
                }],
                showAction: false,
                approvalActions: [],
                selectApprovalData: '',
                approvalList: [],
                approvalProcessList: [],
                status: -1,
                creater: '',
                createTime: '',
                approvalID: 0,
                approveStr: '',
                level: 0,
                finalResult: 0,
                readArray: [],
                unReadArray: [],
                form: {
                    id: api.pageParam.id || 0,
                    isFinish: false,
                    isReworkDepart: false,
                    reworkDepart: '',
                    code: !api.pageParam.id && ('ERW' + APP.getFormatNo()),
                    // project: '',
                    // pname: '',
                    // pcode: '',
                    ExptItemID: 0,
                    ExptItemName: '',
                    // pid: 0,
                    badtype: '',
                    procedurename: '',
                    personname: APP.getUserInfo().UserName || '',
                    personid: APP.getUserInfo().UserID || 0,
                    persondepartname: APP.getUserInfo().ClassName || '',
                    persondepartid: APP.getUserInfo().ClassID || 0,
                    reason: '',
                    remark: '',
                    memo: '',
                    memoImg: [],
                    imgArray: [],
                    // appearance: '',
                    // size: '',
                    // performance: '',
                    // others: '',
                    opinion: ''
                },
                curRowIdx: 0,    //当前实验产品
                dataList: [],
                timeout: 15,
                editRemark: true
            },
            created: function () {
                var that = this;

                // if (APP.getUserInfo().UserID == 19 || APP.getUserInfo().UserID == 35 || APP.getUserInfo().UserID == 33) {
                // 	that.editRemark = true;
                // }

                APP.ajax('getApproveModel', {}, function (res) {
                    var approvalActions = [];
                    for (var i in res.ds) {
                        if (res.ds[i].AppFormName == 'approvalPage1') {
                            res.ds[i].name = res.ds[i].BillName;
                            approvalActions.push(res.ds[i])
                        }

                    }
                    that.approvalActions = approvalActions;


                    APP.ajax('getCkUserList', {}, function (res) {

                        that.personList = res.ds;

                        if (that.form.id) {
                            that.checkIsShowButton();
                            that.initPageData();
                        } else {
                            that.status = 0;
                        }
                    })
                })

            },
            methods: {

                post: function (sql, param, callBack) {
                    //
                    var that = this;
                    param["sql"] = sql;
                    $.ajax({
                        url: "http://" + APP.serverIP() + "/SQLData/QuerySql",
                        type: "post",
                        dataType: "json",
                        async: false,
                        data: param,
                        success: function (data) {
                            if (data.status == 200) {
                                callBack(data.data);
                            } else {
                                alert(data.msg)
                            }
                        }
                    });
                },

                splitMemo: function () {
                    var that = this;
                    return that.form.memo.split(';');
                },
                getRealNum: function (row) {
                    var that = this;
                    var t = 0;
                    for (var i in row.node) {
                        if (!row.node[i].unJoin) {
                            t++;
                        }
                    }
                    return t;
                },
                toggleUserCheck: function (row, item) {
                    var that = this;
                    if (typeof item.unJoin === 'undefined') {
                        that.$set(item, 'unJoin', true);
                        var x = 1;
                        for (var i in row.node) {
                            if (!row.node[i].unJoin) {
                                x = 0;
                            }
                        }
                        if (x == 1) {
                            layer.open({
                                content: '请至少选择一人',
                                skin: 'msg',
                                time: 2
                            });
                            that.$set(item, 'unJoin', false);
                        }
                    } else {
                        that.$set(item, 'unJoin', !item.unJoin);
                        // item.unJoin = !item.unJoin;
                        // alert(item.unJoin)
                        var x = 1;
                        for (var i in row.node) {
                            if (!row.node[i].unJoin) {
                                x = 0;
                            }
                        }
                        if (x == 1) {
                            layer.open({
                                content: '请至少选择一人',
                                skin: 'msg',
                                time: 2
                            });
                            item.unJoin = !item.unJoin;
                        }

                    }

                },
                showMore: function (row) {
                    var that = this;
                    if (row.showMore) {
                        that.$set(row, 'showMore', false);
                    } else {
                        that.$set(row, 'showMore', true);
                    }

                },
                getApprovalProcess: function (id) {
                    var that = this;
                    function recursionFunc(data) {
                        var approvalProcessList = [];
                        var repeatConfig = function (x, row) {
                            var processData = {
                                type: row.type,
                                approvalType: row.examineMode == 1 ? 0 : 1,
                                nodeName: row.nodeName,
                                node: [],
                                checked: false,
                                data: row
                            }
                            if (row.settype == 7) {
                                processData.node.push({
                                    name: row.examineEndDirectorLevel + '级主管'
                                })
                            } else {
                                processData.node = row.nodeUserList;
                            }
                            approvalProcessList.push(processData)
                            if (row.childNode) {
                                repeatConfig(x + 1, row.childNode);
                            }
                        }
                        if (data && data.nodeConfig) {
                            repeatConfig(0, data.nodeConfig.childNode);
                        }
                        return approvalProcessList;
                    }

                    APP.ajax('GetApproveByID', { APFlowID: id }, function (res) {
                        approvalConfigdata = JSON.parse(res.ds[0].AppConfigStr);

                        // if (that.isExamine == 2) {
                        var approvalProcessList = recursionFunc(approvalConfigdata);
                        var newApprovalProcessList = [];
                        if (that.approveStr) {
                            newApprovalProcessList = recursionFunc(JSON.parse(that.approveStr));
                        }
                        for (var i in approvalProcessList) {
                            var w = 0;
                            for (var j in newApprovalProcessList) {
                                if (approvalProcessList[i].nodeName == newApprovalProcessList[j].nodeName) {
                                    w = 1
                                    approvalProcessList[i].checked = true;

                                    for (var m in approvalProcessList[i].node) {
                                        var v = 0;
                                        for (var n in newApprovalProcessList[j].node) {
                                            if (approvalProcessList[i].node[m].name == newApprovalProcessList[j].node[n].name) {
                                                v = 1;
                                                approvalProcessList[i].node[m].unJoin = false;
                                            }
                                        }
                                        if (!v) {
                                            approvalProcessList[i].node[m].unJoin = true;
                                        }
                                    }

                                }
                            }
                            if (!w && newApprovalProcessList.length) {
                                approvalProcessList[i].checked = false;
                            }
                        }
                        that.approvalProcessList = approvalProcessList;

                    })



                },
                previewItemImage: function (imgs, index) {
                    var that = this;
                    var array = imgs.split(',');
                    for (var i in array) {
                        array[i] = that.serverIP + array[i];
                    }
                    photoBrowser.open({
                        images: array,
                        activeIndex: index,
                        bgColor: '#000'
                    }, function (ret) {
                        isOpenImg = true;
                        if (ret) {
                            if (ret.eventType == 'click') {
                                isOpenImg = false;
                                photoBrowser.close();
                            }
                        }
                    })
                },
                previewImage: function (index, type) {
                    var that = this;
                    var array = JSON.parse(JSON.stringify(type == 1 ? that.form.imgArray : that.form.memoImg));
                    for (var i in array) {
                        array[i] = that.serverIP + array[i];
                    }
                    photoBrowser.open({
                        images: array,
                        activeIndex: index,
                        bgColor: '#000'
                    }, function (ret) {
                        isOpenImg = true;
                        if (ret) {
                            if (ret.eventType == 'click') {
                                isOpenImg = false;
                                photoBrowser.close();
                            }
                        }
                    })
                },
                deleteImgItem: function (index) {
                    var that = this;
                    that.form.imgArray.splice(index, 1)
                },
                addImage: function (len) {
                    var that = this;
                    //
                    UIAlbumBrowser.imagePicker({
                        max: 15 - len,
                        styles: {
                            nav: {
                                bg: 'rgba(0,0,0,.6)',
                                finishText: '完成'
                            }
                        },
                        rotation: true
                    }, function (ret) {
                        if (ret) {
                            if (ret.originalPath) {
                                UIAlbumBrowser.transPath({
                                    path: ret.assetPath || ret.originalPath
                                }, function (ret, err) {
                                    if (ret) {
                                        APP.uploadFile('审批图片1', ret.path, function (path) {
                                            that.form.imgArray.push(path);
                                        })

                                    }
                                });
                            } else if (ret.eventType == 'nextStep') {
                                UIAlbumBrowser.closePicker();
                                var imgLists = ret.list;
                                var repeatImg = function (i) {
                                    if (i == imgLists.length) {
                                        return;
                                    }
                                    UIAlbumBrowser.transPath({
                                        path: imgLists[i].path
                                    }, function (ret, err) {
                                        if (ret) {
                                            APP.uploadFile('审批图片1', ret.path, function (path) {
                                                that.form.imgArray.push(path);
                                            })
                                            i++;
                                            repeatImg(i);
                                        }
                                    });
                                }
                                repeatImg(0)

                            }

                        }
                    });
                },
                //是否显示审批按钮
                checkIsShowButton: function () {
                    var that = this;
                    var obj = {
                        //  P_TableName: 'Ck_Review',
                        P_TableName: 'Ck_ExperimentReview',
                        P_PKValue: that.form.id
                    }
                    APP.ajax('WhetherItCanBeApproved', obj, function (res) {
                        that.showButton = res.ds[0].ISSP;
                    })
                },
                filterPersonList: function (str, value) {
                    var that = this;
                    var row = null;
                    for (var i in that.personList) {
                        if (that.personList[i][str] == value) {
                            row = that.personList[i];
                            break;
                        }
                    }
                    return row;
                },
                getApprovalTagImg: function (row) {
                    var that = this;
                    if (row.node.length == 1) {
                        if (row.node[0].Approve == 0) {
                            return '../image/doing.png';
                        } else if (row.node[0].Approve == 1) {
                            return '../image/success.png';
                        } else if (row.node[0].Approve == 2) {
                            return '../image/fail.png';
                        }
                    } else {

                        var imgstr = '';
                        var z = 0;
                        for (var i in row.node) {
                            if (row.node[i].Approve == 1) {
                                z++;
                            }
                            if (row.node[i].Approve == 2) {
                                imgstr = '../image/fail.png';
                                break;
                            }
                        }
                        if (imgstr) {
                            return imgstr;
                        } else {
                            if (z == 0) {
                                imgstr = '../image/doing.png'
                            } else {
                                if (row.node.length == z) {
                                    imgstr = '../image/success.png'
                                } else {
                                    imgstr = '../image/doing.png';
                                }
                            }

                        }
                        return imgstr;
                    }
                },
                getApprovalText: function (row) {
                    var that = this;
                    if (row.type == 1) {
                        if (row.node[0].Approve == 0) {
                            return '未抄送';
                        } else {
                            return '已抄送';
                        }
                    } else {
                        if (row.node.length == 1) {
                            if (row.node[0].Approve == 0) {
                                return '审批中';
                            } else if (row.node[0].Approve == 1) {
                                return '已同意';
                            } else if (row.node[0].Approve == 2) {
                                return '已拒绝';
                            }
                        } else {
                            var str = '';
                            var z = 0;
                            for (var i in row.node) {
                                if (row.node[i].Approve == 1) {
                                    z++;
                                }
                                if (row.node[i].Approve == 2) {
                                    str = '已拒绝';
                                    break;
                                }
                            }
                            if (str) {
                                return str;
                            } else {
                                if (z == 0) {
                                    str = '审批中'
                                } else {
                                    if (row.node.length == z) {
                                        str = '已同意'
                                    } else {
                                        str = z + '人同意';
                                    }
                                }

                            }
                            return str;
                        }
                    }
                },
                cutStr: function (str) {
                    var that = this;
                    return str && str.substring(str.length - 2);
                },
                checkIsSingle: function (row) {
                    var that = this;
                    var x = true;
                    for (var i in row.node) {
                        if (row.node[i].CurrentApprovalIDs.length > 1) {
                            x = false;
                        }
                    }
                    return x;
                },
                initPageData: function (apstatus) {
                    var that = this;
                    var obj1 = {
                        Ck_ExperimentReviewID: that.form.id
                    }
                    APP.ajax('getExperimentInfo', obj1, function (res) {

                        if (res.ds.length) {
                            // that.form.isFinish = res.ds[0].IsFinish || false;
                            that.form.reworkDepart = res.ds[0].ReworkDepart;
                            that.form.isReworkDepart = res.ds[0].IsReworkDepart || false;
                            that.form.code = res.ds[0].BillNO;
                            that.form.ExptItemID = res.ds[0].ExptItemID;
                            that.form.ExptItemName = res.ds[0].ExptItemName;
                            // that.form.project = res.ds[0].Program;
                            // that.form.pname = res.ds[0].ProductName;
                            // that.form.pcode = res.ds[0].ProductCode;
                            // that.form.pid = res.ds[0].ProductID;
                            that.form.personname = res.ds[0].UserName;
                            that.form.personid = res.ds[0].UserID;
                            that.form.persondepartname = res.ds[0].ClassName;
                            that.form.persondepartid = res.ds[0].ClassID;
                            that.form.reason = res.ds[0].NgCause;
                            that.form.remark = res.ds[0].FRemarks;
                            that.form.memo = res.ds[0].Memo;
                            that.form.memoImg = res.ds[0].MemoImg ? res.ds[0].MemoImg.split(',') : [];
                            // that.form.appearance = res.ds[0].Appearance;
                            // that.form.size = res.ds[0].Size;
                            // that.form.performance = res.ds[0].Performance;
                            // that.form.others = res.ds[0].Others;
                            that.form.imgArray = res.ds[0].Imgs ? (res.ds[0].Imgs.split(',')) : [];
                            that.form.opinion = res.ds[0].Explain;
                            that.form.procedurename = res.ds[0].ModuleType;
                            that.form.badtype = res.ds[0].NGType;

                            that.creater = res.ds[0].Creater;
                            that.createTime = res.ds[0].CreateTime;
                            that.status = res.ds[0].Status;
                            that.approvalID = res.ds[0].APFlowID;
                            that.approveStr = res.ds[0].approveStr;

                            // for (var i in that.approvalActions) {
                            // 	if (that.approvalActions[i].APFlowID == that.approvalID) {
                            // 		that.selectApprovalData = that.approvalActions[i];
                            // 		break;
                            // 	}
                            // }

                            that.dataList = res.ds1;

                            if (that.status == 0) {
                                //获取审批流配置列表
                                if (that.approvalID) {
                                    that.approvalID && that.getApprovalProcess(that.approvalID);
                                } else {

                                    if (that.approvalActions.length) {
                                        that.getApprovalProcess(that.approvalActions[0].APFlowID)
                                    }


                                }
                            } else {
                                var obj2 = {
                                    P_PKValue: that.form.id,
                                    P_TableName: 'Ck_ExperimentReview'
                                }
                                APP.ajax('Select_FlowLog1', obj2, function (res) {

                                    if (res.ds[res.ds.length - 1].Approve == 1) {
                                        that.finalResult = 1;
                                    }

                                    var data = [];
                                    allCurrentApprovalIDs = [];
                                    var allCurrentApprovalIDs2 = [];
                                    for (var i in res.ds) {

                                        res.ds[i].CurrentApprovalIDs = res.ds[i].CurrentApprovalIDs.replace(/^,+/, "").replace(/,+$/, "").split(',');

                                        allCurrentApprovalIDs = allCurrentApprovalIDs.concat(res.ds[i].CurrentApprovalIDs);
                                        if (res.ds[i].FlowType != 1) {
                                            allCurrentApprovalIDs2 = allCurrentApprovalIDs2.concat(res.ds[i].CurrentApprovalIDs);
                                        }
                                        for (var c in res.ds[i].CurrentApprovalIDs) {
                                            var row = that.filterPersonList('UserID', res.ds[i].CurrentApprovalIDs[c])
                                            if (row) {
                                                res.ds[i].CurrentApprovalIDs[c] = row.UserName;
                                            }

                                        }

                                        if (data.indexOf(res.ds[i].AuditID) == -1) {
                                            data.push(res.ds[i].AuditID);
                                        }
                                    }

                                    var approvalList = [];
                                    for (var n in data) {
                                        var approvalNodeList = [];
                                        var level = 0;
                                        var finLevel = 0;
                                        for (var i in res.ds) {
                                            if (data[n] == res.ds[i].AuditID) {

                                                if (res.ds[i].Approve == 0 && !level) {
                                                    level = res.ds[i].ApprovalSort;
                                                }

                                                if (res.ds[i].Approve == 1 && i == res.ds.length - 1) {
                                                    level = res.ds[i].ApprovalSort;
                                                }

                                                if (res.ds[i].Approve == 2 && !finLevel) {
                                                    finLevel = res.ds[i].ApprovalSort;
                                                }


                                                if (res.ds[i].Approve == 2 && n == data.length - 1) {
                                                    that.finalResult = 2;
                                                }



                                                var x = 0;
                                                for (var j in approvalNodeList) {
                                                    if (approvalNodeList[j].index == res.ds[i].ApprovalSort) {
                                                        x = 1;
                                                        approvalNodeList[j].node.push(res.ds[i]);
                                                    }
                                                }
                                                if (!x) {
                                                    approvalNodeList.push({
                                                        index: res.ds[i].ApprovalSort,
                                                        type: res.ds[i].FlowType,
                                                        department: res.ds[i].ApprovalName,
                                                        node: [res.ds[i]]
                                                    })
                                                }
                                            }

                                        }
                                        approvalList.push({
                                            level: finLevel ? (finLevel - 1) : (level - 1),
                                            approvalNodeList: approvalNodeList
                                        })
                                    }


                                    var p1 = 0;
                                    var y = 0;
                                    if (that.finalResult == 1) {
                                        for (var i in res.ds) {
                                            if (res.ds[i].Approver && res.ds[i].FlowType != 1) {
                                                p1++;
                                                if (res.ds[i].Approver == that.userData.UserName) {
                                                    y = 1;

                                                }
                                            }

                                        }

                                        APP.ajax('getReadUserList', { Ck_ReviewID: that.form.id }, function (res1) {

                                            that.readArray = res1.ds;
                                            var unReadArray = [];
                                            for (var m in res.ds) {
                                                if (res.ds[m].FlowType != 1) {
                                                    var z = 0;
                                                    for (var n in that.readArray) {
                                                        if (res.ds[m].Approver == that.readArray[n].LogCount) {
                                                            z = 1;
                                                        }
                                                    }
                                                    if (z == 0) {
                                                        unReadArray.push(res.ds[m])
                                                    }
                                                }

                                            }
                                            that.unReadArray = unReadArray;

                                            if (y == 1) {
                                                APP.ajax('insertReadReview', { Ck_ReviewID: that.form.id });

                                                var x = 0;
                                                for (var i in res1.ds) {
                                                    if (res1.ds[i].UserID == that.userData.UserID) {
                                                        x = 1;
                                                    }
                                                }
                                                if (x == 0) {
                                                    var obj = {
                                                        Ck_ReviewID: that.form.id,
                                                        ApplyTotalNum: p1,
                                                        ReadTotalNum: res1.ds.length + 1
                                                    }
                                                    APP.ajax('updateCkReviewNum', obj, function (res) {
                                                        api.sendEvent({
                                                            name: 'refreshList'
                                                        });
                                                    })
                                                }
                                            }

                                        })


                                    }



                                    that.approvalList = approvalList;

                                    if (apstatus && that.status == 2 && that.finalResult == 1 && !that.form.isFinish && allCurrentApprovalIDs2.indexOf('19') == -1) {
                                        that.closeRow(true);
                                    }

                                })
                            }
                        } else {
                            layer.open({
                                content: '记录已删除',
                                skin: 'msg',
                                time: 2,
                                end: function () {
                                    api.closeWin()
                                }
                            });
                        }





                    })
                },
                selectApproval: function () {
                    var that = this;
                    // that.showAction = true;
                    that.getApprovalProcess(that.approvalActions[0].APFlowID)
                },

                confirmProcedureAction: function (action, index) {
                    var that = this;
                    that.form.procedurename = action.name;
                },
                openBaseScreen: function (str) {
                    var that = this;
                    var obj;
                    if (str == '产品') {
                        obj = {

                            allowClear: false,
                            cmd: 'getCkProductList',
                            type: str,
                            // localSearch:{
                            // 	showText:'',		//查询结果显示的字段
                            // 	searchBy:['']		//按那些字段进行搜索
                            // },
                            serverSearch: {
                                isPaging: true,		//是否分页
                                searchKey: 'ProductName',		//搜索关键词，应包含在param中
                                showText: 'ProductName',		//查询结果显示的字段
                                pageIndexStr: 'pageIndex'		//分页页码字段，应包含在param中
                            },
                            param: {
                                pageIndex: 1,
                                ProductName: ''
                            }

                        }
                    }
                    if (str == '人员') {
                        obj = {

                            allowClear: false,
                            cmd: 'getCkUserList',
                            type: str,
                            localSearch: {
                                showText: 'UserName',		//查询结果显示的字段
                                searchBy: ['UserName']		//按那些字段进行搜索
                            },
                            param: {

                            }

                        }
                    }
                    if (str == '实验项目') {
                        obj = {

                            allowClear: false,
                            cmd: 'getCheckExptItem',
                            type: str,
                            localSearch: {
                                showText: 'ExptItemName',		//查询结果显示的字段
                                searchBy: ['ExptItemName']		//按那些字段进行搜索
                            },
                            param: {

                            }

                        }
                    }
                    api.openWin({
                        name: 'baseScreen',
                        url: 'tool/baseScreen.html',
                        reload: true,
                        slidBackEnabled: false,
                        allowEdit: true,
                        pageParam: obj
                    })
                },
                getStrConfigData: function () {
                    var that = this;

                    //生成审批流字符串
                    var childNodeList = null;
                    for (var i = that.approvalProcessList.length - 1; i >= 0; i--) {
                        if (that.approvalProcessList[i].checked) {
                            that.approvalProcessList[i].data.childNode = JSON.parse(JSON.stringify(childNodeList));
                            childNodeList = that.approvalProcessList[i].data;
                            var userList = [];
                            for (var j in that.approvalProcessList[i].node) {
                                if (!that.approvalProcessList[i].node[j].unJoin) {
                                    userList.push(that.approvalProcessList[i].node[j])
                                }
                            }
                            childNodeList.nodeUserList = userList;
                        }

                    }
                    var newApprovalConfigdata = JSON.parse(JSON.stringify(approvalConfigdata));
                    newApprovalConfigdata.nodeConfig.childNode = childNodeList;
                    return JSON.stringify(newApprovalConfigdata)

                },
                // 单据保存
                savePage: function (state) {
                    var that = this;
                    var ProductID = [], Batch = [], Result = []; //产品，批次，实验结果
                    //验证主表信息
                    if (!that.form.ExptItemName) {
                        layer.open({
                            content: '请选择实验项目',
                            skin: 'msg',
                            time: 2
                        });
                        return false;
                    }
                    if (!that.form.procedurename) {
                        layer.open({
                            content: '请选择工序',
                            skin: 'msg',
                            time: 2
                        });
                        return false;
                    }
                    if (!that.form.reason) {
                        layer.open({
                            content: '请输入不良原因',
                            skin: 'msg',
                            time: 2
                        });
                        return false;
                    }
                    if (!that.form.personid) {
                        layer.open({
                            content: '请选择申请人',
                            skin: 'msg',
                            time: 2
                        });
                        return false;
                    }
                    if (!that.timeout) {
                        layer.open({
                            content: '请输入超时时间',
                            skin: 'msg',
                            time: 2
                        });
                        return false;
                    }
                    //验证子表信息
                    if (!vm.dataList.length) {
                        layer.open({
                            content: '请添加实验记录',
                            skin: 'msg',
                            time: 2
                        });
                        return false;
                    }

                    for (var i = 0; i < vm.dataList.length; i++) {
                        ProductID.push(vm.dataList[i].ProductID);
                        Batch.push(vm.dataList[i].Batch);
                        var resultCode = 0;
                        if (vm.dataList[i].Result == 'OK')
                            resultCode = 1;
                        else if (vm.dataList[i].Result == 'NG')
                            resultCode = -1;
                        Result.push(resultCode);
                    }
                    //子表数据
                    var objDtl = {
                        ProductIDs: ProductID.join('~'),
                        Batchs: Batch.join('~'),
                        Results: Result.join('~')
                    }
                    //表体数据
                    var obj = {
                        Ck_ExperimentReviewID: that.form.id,
                        // Program: that.form.project,
                        BillNO: that.form.code,
                        UserID: that.form.personid,
                        // ProductID: that.form.pid,
                        ExptItemID: that.form.ExptItemID,   //实验项目ID
                        ExptItemName: that.form.ExptItemName,    //实验项目名称
                        NgCause: that.form.reason,
                        FRemarks: that.form.remark,
                        ClassID: that.form.persondepartid,
                        APFlowID: 0,
                        P_Timeout: that.timeout,
                        // Appearance: that.form.appearance,
                        // Size: that.form.size,
                        // Performance: that.form.performance,
                        // Others: that.form.others,
                        Imgs: that.form.imgArray.join(),
                        ModuleType: that.form.procedurename,
                        NGType: that.form.badtype,
                        IsReworkDepart: that.form.isReworkDepart
                    }
                    var pageData = Object.assign(objDtl, obj);
                    that.ifConfirm = true;

                    if (that.form.id) {
                        APP.ajax('updateExptReviewApprove', pageData, function (res) {   //修改实验评审审批流
                            that.ifConfirm = false;
                            layer.open({
                                content: '修改成功',
                                skin: 'msg',
                                time: 2
                            });
                        })
                    } else {
                        APP.ajax('addExptReviewApprove', pageData, function (res) {  //新增实验评审审批流
                            that.ifConfirm = false;
                            that.form.id = res.ds[0].Ck_ExperimentReviewID;
                            // vm.checkIsShowButton();

                            that.$dialog.alert({
                                title: '提示',
                                message: '单据提交送审成功，请耐心等待相关人员确认',
                            }).then(function () {
                                // api.closeWin();
                                vm.initPageData();
                            });

                        })
                    }



                },
                //index:0同意 1拒绝
                initiateApproval: function (index, content) {
                    var that = this;
                    if (that.form.id) {
                        if (that.isExamine == 1) {
                            var obj = {
                                TableName: 'Ck_ExperimentReview',
                                Ck_ExperimentReviewID: that.form.id,
                                // ApprovalID: that.selectApprovalData ? that.selectApprovalData.APFlowID : 0,
                                approveType: index,
                                Explain: content,
                                approveStr: that.getStrConfigData()
                            }
                            that.ifConfirm = true;
                            APP.ajax('bgApprove2', obj, function (res) {
                                that.ifConfirm = false;
                                if (res.ds.length && res.ds[0].status && res.ds[0].status == 500) {
                                    layer.open({
                                        content: res.ds[0].msg,
                                        skin: 'msg',
                                        time: 2
                                    });
                                } else {
                                    if (index == 1) {
                                        layer.open({
                                            content: '该单据已拒绝审批',
                                            skin: 'msg',
                                            time: 2
                                        });
                                    } else {

                                        if (APP.getUserInfo().UserID == 18 || APP.getUserInfo().UserID == 19) {
                                            that.isExamine = 2;
                                            that.initiateApproval(index, content);
                                            return;
                                        } else {
                                            layer.open({
                                                content: '审批提交成功',
                                                skin: 'msg',
                                                time: 2
                                            });
                                        }
                                    }
                                    that.isSubmit = true;
                                    that.finalResult = 0;
                                    that.approvalAgain = false;
                                    that.checkIsShowButton();
                                    that.initPageData();

                                    api.sendEvent({
                                        name: 'refreshList'
                                    });
                                }

                            })
                        } else if (that.isExamine == 0) {   //isExamine默认0

                            function submitApproaval(id) {
                                var obj = {
                                    TableName: 'Ck_ExperimentReview',
                                    Ck_ExperimentReviewID: that.form.id,
                                    ApprovalID: id,
                                    approveType: index,
                                    Explain: content
                                }
                                that.ifConfirm = true;
                                //bgApprove替换为startExptReviewApprove审批流
                                APP.ajax('startExptReviewApprove', obj, function (res) {
                                    that.ifConfirm = false;
                                    if (res.ds.length && res.ds[0].status && res.ds[0].status == 500) {
                                        layer.open({
                                            content: res.ds[0].msg,
                                            skin: 'msg',
                                            time: 2
                                        });
                                    } else {
                                        if (index == 1) {
                                            layer.open({
                                                content: '该单据已拒绝审批',
                                                skin: 'msg',
                                                time: 2
                                            });
                                        } else {
                                            layer.open({
                                                content: '审批提交成功',
                                                skin: 'msg',
                                                time: 2
                                            });
                                        }
                                        that.isSubmit = true;
                                        that.finalResult = 0;
                                        that.approvalAgain = false;
                                        that.checkIsShowButton();
                                        that.initPageData();

                                        api.sendEvent({
                                            name: 'refreshList'
                                        });
                                    }

                                })
                            }

                            if (index == 1) {
                                submitApproaval(0);
                            } else {    //支持实验评审单动态生成审批流，20220316
                                var iobj = {
                                    BillName: 'approvalPage27_' + new Date().getTime(),
                                    AppFormName: 'approvalPage27',
                                    AppConfigStr: that.getStrConfigData()
                                }
                                APP.ajax('insertApproveConfig', iobj, function (res) {
                                    var id = res.ds[0].APFlowID;

                                    that.post('delete SYS_BillAPFlowDe where APFlowID=' + id, {}, function () {
                                        try {
                                            var appConfigObj = JSON.parse(that.getStrConfigData());
                                            var aPUserIDs = [], classIDs = []
                                            for (var q = 0; q < appConfigObj.flowPermission.length; q++) {
                                                if (appConfigObj.flowPermission[q].type == 1) {
                                                    aPUserIDs.push(appConfigObj.flowPermission[q].targetId);
                                                } else if (appConfigObj.flowPermission[q].type == 3) {
                                                    classIDs.push(appConfigObj.flowPermission[q].targetId);
                                                }
                                            }
                                            //保存发起人
                                            var sql = 'insert into SYS_BillAPFlowDe(APFlowID,APFlowNO,APUserID,RoleIDs,JobLevel,ClassIDs,SignedWay,FlowType,FlowName) values(@APFlowID,@APFlowNO,@APUserID,@RoleIDs,@JobLevel,@ClassIDs,@SignedWay,@FlowType,@FlowName)';
                                            that.post(sql, {
                                                APFlowID: id,
                                                APFlowNO: '0',
                                                APUserID: aPUserIDs.join(','),
                                                RoleIDs: '',
                                                JobLevel: '0',
                                                ClassIDs: classIDs.join(','),
                                                SignedWay: '0',
                                                FlowType: '0',
                                                FlowName: ''
                                            }, function () { });
                                            //保存各级审批及抄送人
                                            var saveApproveFunc = function (node, flowNo) {
                                                var caPUserIDs = [], cclassIDs = [], croleIDs = []
                                                var Joblevel = 0;
                                                var flowType = 0;
                                                var signedWay = 0;
                                                for (var k = 0; k < node.nodeUserList.length; k++) {
                                                    if (node.nodeUserList[k].type == 1) {
                                                        caPUserIDs.push(node.nodeUserList[k].targetId);
                                                    } else if (node.nodeUserList[k].type == 3) {
                                                        cclassIDs.push(node.nodeUserList[k].targetId);
                                                    } else if (node.nodeUserList[k].type == 2) {
                                                        croleIDs.push(node.nodeUserList[k].targetId);
                                                    }
                                                }
                                                if (node.settype == 7) {
                                                    Joblevel = node.examineEndDirectorLevel;
                                                }
                                                if (node.type == 1) {
                                                    flowType = 0;
                                                } else {
                                                    flowType = 1;
                                                }
                                                if (node.examineMode == 1) {
                                                    signedWay = 0;
                                                } else {
                                                    signedWay = 1;
                                                }
                                                var flowName = node.nodeName;

                                                that.post(sql, {
                                                    APFlowID: id,
                                                    APFlowNO: flowNo,
                                                    APUserID: caPUserIDs.join(','),
                                                    RoleIDs: croleIDs.join(','),
                                                    JobLevel: Joblevel,
                                                    ClassIDs: cclassIDs.join(','),
                                                    SignedWay: signedWay,
                                                    FlowType: flowType,
                                                    FlowName: flowName
                                                }, function () { });
                                                flowNo++
                                                saveApproveFunc(node.childNode, flowNo);

                                            }
                                            saveApproveFunc(appConfigObj.nodeConfig.childNode, 1);
                                        } catch (e) {
                                            // alert(e)
                                            submitApproaval(id);
                                        }
                                    });


                                })
                            }



                        }




                    }
                },
                initiateApprovalAgain: function () {
                    var that = this;
                    if (that.approvalAgain) {
                        that.savePage(true);
                    } else {
                        that.approvalAgain = true;
                        that.getApprovalProcess(that.approvalID);
                    }

                },
                dealApproval: function (index) {
                    var that = this;
                    if (index == 1 && that.status == 0) {
                        var x = 0;
                        for (var i in that.approvalProcessList) {
                            if (that.approvalProcessList[i].checked == true) {
                                x = 1;
                            }
                        }
                        if (x == 0) {
                            that.$dialog.alert({
                                title: '提示',
                                message: '请先完善当前审批流程!',
                            }).then(function () {

                            });
                        } else {
                            that.$dialog.confirm({
                                title: '提示',
                                message: '是否确认当前审批流程?'
                            }).then(function () {
                                var status = false;
                                if (that.status == 1) {
                                    var nowLevel = that.approvalList[that.approvalList.length - 1].level;
                                    if (that.approvalList[that.approvalList.length - 1].approvalNodeList[nowLevel].department.indexOf('经理') == -1) {
                                        status = true;
                                    }
                                }
                                api.openWin({
                                    name: 'approvalDeal',
                                    url: 'approvalDeal.html',
                                    reload: true,
                                    slidBackEnabled: false,
                                    allowEdit: true,
                                    pageParam: {
                                        index: index,
                                        status: status
                                    }
                                })
                            }).catch(function () {

                            });
                        }
                    } else {
                        var status = false;
                        var showPhone = false;
                        var reWork = false;
                        if (that.status == 1) {
                            var nowLevel = that.approvalList[that.approvalList.length - 1].level;
                            if (that.approvalList[that.approvalList.length - 1].approvalNodeList[nowLevel].department.indexOf('经理') == -1) {
                                status = true;
                            }
                            if (that.approvalList[that.approvalList.length - 1].approvalNodeList[nowLevel].department.indexOf('品质') > -1) {
                                showPhone = true;
                            }
                            if (that.userData.UserID == 35 && that.form.isReworkDepart) {
                                reWork = true;
                            }
                        }
                        api.openWin({
                            name: 'approvalDeal',
                            url: 'approvalDeal.html',
                            reload: true,
                            slidBackEnabled: false,
                            allowEdit: true,
                            pageParam: {
                                approvalID: that.approvalID,
                                index: index,
                                status: status,
                                showPhone: showPhone,
                                reWork: reWork
                            }
                        })
                    }





                },
                submitApproval: function (index, content, imgArray, reworkDepart) {
                    var that = this;
                    var obj = {
                        TableName: 'Ck_ExperimentReview',
                        ApprovalSort: that.approvalList[that.approvalList.length - 1].level + 1,
                        ApprovalID: that.approvalID,
                        ApprovalContent: (that.status == 1 && index == 1 && !content) ? '同意' : content,
                        Approve: index,
                        KeyID: that.form.id,
                        Imgs: imgArray ? imgArray.join() : ''
                    }
                    APP.ajax('Ck_ApprovalForm', obj, function (res) {
                        that.ifConfirm = false;
                        if (res.ds.length && res.ds[0].status && res.ds[0].status == 500) {
                            layer.open({
                                content: res.ds[0].msg,
                                skin: 'msg',
                                time: 2
                            });
                        } else {
                            if (reworkDepart) {
                                var obj = {
                                    Ck_ExperimentReviewID: that.form.id,
                                    reworkDepart: reworkDepart
                                }
                                APP.ajax('updateReworkDepart', obj, function (res) {
                                    layer.open({
                                        content: '审批成功',
                                        skin: 'msg',
                                        time: 2
                                    });
                                    that.checkIsShowButton();
                                    that.initPageData(true);

                                    api.sendEvent({
                                        name: 'refreshList'
                                    });
                                })
                            } else {
                                layer.open({
                                    content: '审批成功',
                                    skin: 'msg',
                                    time: 2
                                });
                                that.checkIsShowButton();
                                that.initPageData(true);

                                api.sendEvent({
                                    name: 'refreshList'
                                });
                            }

                        }

                    })
                },
                startApproval: function (index, content) {
                    var that = this;
                    that.initiateApproval(index == 2 ? 1 : 0, content);
                },
                addRemark: function () {
                    var that = this;
                    if (that.editRemark) {
                        api.openWin({
                            name: 'editRemark',
                            url: 'editRemark.html',
                            reload: true,
                            slidBackEnabled: false,
                            allowEdit: true,
                            pageParam: {
                                img: that.form.memoImg
                            }
                        })
                    }

                },
                closeRow: function (apstatus) {
                    var that = this;
                    if (apstatus) {
                        var obj = {
                            Ck_ReviewID: that.form.id
                        }
                        APP.ajax('SetFinishApply', obj, function (res) {
                            layer.open({
                                content: '单据已确认完成',
                                skin: 'msg',
                                time: 2
                            });
                            that.initPageData();
                        })
                    } else {
                        that.$dialog.confirm({
                            title: '提示',
                            message: '是否确认完成此单据?'
                        }).then(function () {
                            var obj = {
                                Ck_ReviewID: that.form.id
                            }
                            APP.ajax('SetFinishApply', obj, function (res) {
                                layer.open({
                                    content: '单据已确认完成',
                                    skin: 'msg',
                                    time: 2
                                });
                                that.initPageData();
                            })
                        }).catch(function () {

                        });
                    }

                },
                onClickLeft: function () {
                    var that = this;
                    if (!that.form.id) {
                        if (that.form.project || that.form.pname || that.form.procedurename || that.form.badtype || that.form.reason || that.form.imgArray.length || that.form.remark) {
                            that.$dialog.confirm({
                                title: '提示',
                                message: '是否退出实验评审?'
                            }).then(function () {
                                api.closeWin();
                            }).catch(function () {

                            });
                        } else {
                            api.closeWin();
                        }
                    } else {
                        //
                        api.closeWin();
                    }

                },
                addDtlItem: function () {
                    var obj = { ProductID: 0, ProductName: '', Batch: '', Result: '' };
                    vm.dataList.push(obj);
                },
                deleteRow: function (index) {
                    vm.dataList.splice(index, 1);
                },
                confirmResultAction: function (action, index) {
                    vm.dataList[vm.curRowIdx].Result = action.name;
                },
                selectProduct(index) {
                    vm.curRowIdx = index;
                    vm.openBaseScreen('产品');
                },
                selectExResult(index) {
                    vm.curRowIdx = index;
                    vm.showResultAction = true;
                }
            }
        })
    };
</script>

</html>